package base.算法;

import java.util.Arrays;

/**
 *
 * @author scylla
 * @version V1.0
 * @project echo-java-base
 * @title 冒泡排序
 * @package base.算法
 * @since 2023/1/12 3:45 下午
 */
public class BubbleSort {

    public static void main(String[] args) {
        int[] arr = {6, 4, 12, 56, 4, 6, 7, 9, 1, 77, 78, 99, 1534, 63, 42};
        int len = arr.length;
        while (len > 0) {
            for (int i = 0; i < len - 1; i++) {
                int next = i + 1;
                if (arr[i] > arr[next]) {
                    int temp = arr[next];
                    arr[next] = arr[i];
                    arr[i] = temp;
                }
            }
            len--;
        }

    }
}
